<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Screen Management Service</title>
</head>
<body>
	<form id="serviceform" name="serviceform" method="post">
		<input type="hidden" name="screen" value="" />
		<input type="hidden" name="service" value="" />
	</form>
	<script type="text/javascript">
		function changeScreenService(opt) {
			var form = document.serviceform;
			form.screen.value = opt.name;
			form.service.value = opt.value;
			form.submit();
		}
	</script>
	<h2>Screens Management</h2>
	<h4>${time}</h4>
	<table border="1">
		<tr>
			<th style="width: 30px;" align="center">#</th>
			<th style="width: 80px;" align="center">Name</th>
			<th style="width: 200px;" align="center">Service Type</th>
		</tr>
		<c:forEach var="s" items="${screens}">
			<tr>
				<td align="center">${s.id}</td>
				<td align="center">${s.name}</td>
				<td align="center">
					<select onchange="changeScreenService(this);" name="${s.id}">
						<c:forEach var="ser" items="${services}">
							<c:choose>
								<c:when test="${s.serviceType == ser.id}">
									<option value="${ser.id}" selected="selected">${ser.name}</option>
								</c:when>
								<c:otherwise>
									<option value="${ser.id}">${ser.name}</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</select>
				</td>
			</tr>
		</c:forEach>
	</table>
</body>
</html>